package com.youyi.yyviewsdklibrary.Dialog.core;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.youyi.yyviewsdklibrary.Dialog.animator.PopupAnimator;
import com.youyi.yyviewsdklibrary.Dialog.animator.ScaleAlphaAnimator;
import com.youyi.yyviewsdklibrary.Dialog.enums.PopupAnimation;
import com.youyi.yyviewsdklibrary.Dialog.util.XPopupUtils;
import com.lkx.liandianqinew.R;

public class PositionPopupView extends BasePopupView {
    FrameLayout positionPopupContainer = ((FrameLayout) findViewById(R.id.positionPopupContainer));

    public PositionPopupView(Context context) {
        super(context);
        this.positionPopupContainer.addView(LayoutInflater.from(getContext()).inflate(getImplLayoutId(), (ViewGroup) this.positionPopupContainer, false));
    }

    /* access modifiers changed from: protected */
    @Override // com.youyi.yyviewsdklibrary.Dialog.core.BasePopupView
    public final int getInnerLayoutId() {
        return R.layout._xpopup_position_popup_view;
    }

    /* access modifiers changed from: protected */
    @Override // com.youyi.yyviewsdklibrary.Dialog.core.BasePopupView
    public void initPopupContent() {
        super.initPopupContent();
        XPopupUtils.applyPopupSize((ViewGroup) getPopupContentView(), getMaxWidth(), getMaxHeight(), getPopupWidth(), getPopupHeight(), new Runnable() {
            /* class com.youyi.yyviewsdklibrary.Dialog.core.PositionPopupView.AnonymousClass1 */

            public void run() {
                int i;
                if (PositionPopupView.this.popupInfo != null) {
                    if (PositionPopupView.this.popupInfo.isCenterHorizontal) {
                        if (!XPopupUtils.isLayoutRtl(PositionPopupView.this.getContext())) {
                            i = XPopupUtils.getAppWidth(PositionPopupView.this.getContext()) - PositionPopupView.this.positionPopupContainer.getMeasuredWidth();
                        } else {
                            i = -(XPopupUtils.getAppWidth(PositionPopupView.this.getContext()) - PositionPopupView.this.positionPopupContainer.getMeasuredWidth());
                        }
                        PositionPopupView.this.positionPopupContainer.setTranslationX(((float) i) / 2.0f);
                    } else {
                        PositionPopupView.this.positionPopupContainer.setTranslationX((float) PositionPopupView.this.popupInfo.offsetX);
                    }
                    PositionPopupView.this.positionPopupContainer.setTranslationY((float) PositionPopupView.this.popupInfo.offsetY);
                    PositionPopupView.this.initAndStartAnimation();
                }
            }
        });
    }

    /* access modifiers changed from: protected */
    public void initAndStartAnimation() {
        initAnimator();
        doShowAnimation();
        doAfterShow();
    }

    /* access modifiers changed from: protected */
    @Override // com.youyi.yyviewsdklibrary.Dialog.core.BasePopupView
    public PopupAnimator getPopupAnimator() {
        return new ScaleAlphaAnimator(getPopupContentView(), getAnimationDuration(), PopupAnimation.ScaleAlphaFromCenter);
    }
}
